export default function tranTree (arr, rootValue) {
  const newArr = []
  arr.forEach(item => {
    if (item.pid === rootValue) {
      newArr.push(item)

      const children = tranTree(arr, item.id)
      if (children.length > 0) {
        item.children = children
      }
    }
  })
  return newArr
}
